<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/classteacher/js/jquery-3.5.0.js"></script>
    <link rel="stylesheet" type="text/css" href="bootstrap/bootstrap.min.css">
    <script src="/classteacher/Vue/Vue.js"></script>
    <script src="/classteacher/Vue/axios.js"></script>
    <script src="layui/layer/layer.js"></script>
    <style>
        #info{
            width: 500px;
            margin-left: 100px;
            margin-top: 50px;
        }
        h5{
            padding-top: 20px;
        }
    </style>
</head>
<body>
    <div id="info">
        <h5>姓名：<label >{{teacher.name}}</label></h5>
        <h5>账号：<label >{{teacher.account}}</label></h5>
        <h5>科目：<label >{{teacher.subject}}</label></h5>
        <h5>电话：<label >{{teacher.tel}}</label></h5>
        <h5>邮箱：<label >{{teacher.mailbox}}</label></h5>
        <h5>学校：<label >{{teacher.schoolInfo.sname}}</label></h5>
        <h5>任教班级：<label v-for="t in teacher.teamInfos">{{t.tname}}</label></h5>
        <h5>班主任：<label v-for="(value, key) in clazz">{{key}}</label></h5>
    </div>

    <script>
        /*李英勇：老师信息展示*/
        let refreshToken = localStorage.getItem("refreshToken");
        let token=localStorage.getItem("token");

        new Vue({
            el:"#info",
            data:{
                teacher:null,
                clazz:{}
            },
            methods:{
            },
            mounted(){
                axios.get("findTeacherInfo",{
                    headers:{
                        "token":token,
                        "refreshToken":refreshToken
                    }
                }).then(res=>{
                    console.log(res.data.data);
                    if(res.data.code==0){
                        this.teacher=res.data.data;
                        layer.msg(res.data.msg);
                        if(res.headers.token!=null){
                            //更新本地token
                            localStorage.setItem("token",res.headers.token);
                        }
                    }

                });

                axios.get("findStusByTmids",{
                    headers:{
                        "token":token,
                        "refreshToken":refreshToken
                    }
                }).then(res=>{
                    console.log(res.data.data);
                    if(res.data.code==0){
                        this.clazz=res.data.data;
                        layer.msg(res.data.msg);

                        if(res.headers.token!=null){
                            //更新本地token
                            localStorage.setItem("token",res.headers.token);
                        }
                    }

                });
            }
        });
    </script>

</body>
</html>